package com.example.mobile2021606144ywr0506;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private EditText edtMainName;
    private EditText edtMainPassword;
    private Button btnMainLog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        btnMainLog.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(MainActivity.this,ShowDataActivity.class);
                intent.putExtra("userName",edtMainName.getText().toString().trim());
                Bundle bundle=new Bundle();
                bundle.putString("passWord",edtMainPassword.getText().toString().trim());
                intent.putExtras(bundle);
                startActivity(intent);
            }
        });
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tv_main_title);
        edtMainName = (EditText) findViewById(R.id.edt_main_name);
        edtMainPassword = (EditText) findViewById(R.id.edt_main_password);
        btnMainLog = (Button) findViewById(R.id.btn_main_log);
    }
}